﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ch03
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("提示信息！");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("提示信息！","系统提示");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("确定删除吗？", "系统提示", MessageBoxButtons.OKCancel);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            //MessageBox的Show方法会返回一个结果，类型是DialogResult
            DialogResult result = MessageBox.Show("确定删除吗？", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

            //提示完就拿到结果了，然后就可以根据结果进行判断
            if (result == DialogResult.OK)
            {
                this.Controls.Remove(label1);
            }

        }

        private void button5_Click(object sender, EventArgs e)
        {
            MessageBox.Show("确定删除吗？", "系统提示", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
        }
    }
}
